package com.lkj;



import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;

public class FileInputStreamDemo {

    public static void main(String[] args) throws IOException {

        File file = new File("F:\\java\\gather\\io-demo\\index.txt");
        FileInputStream fileInputStream = new FileInputStream(file);

        byte[] buf = new byte[10];
        int len = 0;

        len = fileInputStream.read(buf);
        String string = new String(buf,0,len);
        System.out.println(string);
        System.out.println(len);
        System.out.println(buf.length);
        System.out.println(Arrays.toString(buf));
        System.out.println(new String(buf));
//        while ((len = fileInputStream.read(buf)) !=-1){
//            String string = new String(buf,0,len);
//            System.out.println(string);
//        }

        fileInputStream.close();
    }
}
